﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Follow : MonoBehaviour
{
    /// <summary>
    /// 跟随目标
    /// </summary>
    public Transform followTarget;
    /// <summary>
    /// 方向向量
    /// </summary>
    private Vector3 dir;
    // Start is called before the first frame update
    void Start()
    {
        //获取方向向量
        dir = transform.position - followTarget.position;
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = dir + followTarget.position;
    }
}
